package com.aprivate.leo.commonlib.base;

import android.content.Context;
import android.os.Bundle;

import com.aprivate.leo.commonlib.utils.LogUtils;
import com.aprivate.leo.commonlib.utils.ToastUtils;

import java.lang.ref.WeakReference;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

/**
 * Author: Administrator
 * Date: 2020/2/10
 * Project: ModularizationTemplateApp
 * Description:
 */
public abstract class BaseActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutRes());
        initData();
        initView();
        initListeners();
    }

    protected abstract int getLayoutRes();

    protected abstract void initData();

    protected abstract void initView();

    protected abstract void initListeners();

    protected void showToast(String msg){
        WeakReference<Context> reference = new WeakReference<>(this.getApplicationContext());
        ToastUtils.showToast(reference, msg);
    }

}
